import request from '@/utils/request'

// 拉起服务商列表, 分页, list query: {pageSize, pageNum}
export function fetchList(listQuery) {
  return request({
    url: '/kd_admin//servicer/list',
    method: 'post',
    data: listQuery
  })
}

export function detail(servicerId) {
  return request({
    url: '/kd_admin//servicer/detail',
    method: 'get',
    params: { servicerId }
  })
}

export function add(data) {
  return request({
    url: '/kd_admin//servicer/add',
    method: 'post',
    data: data
  })
}

export function edit(data) {
  return request({
    url: '/kd_admin//servicer/edit',
    method: 'post',
    data: data
  })
}

export function changeStatus(servicerId, status) {
  return request({
    url: '/kd_admin//servicer/change_status',
    method: 'post',
    data: { servicerId, status }
  })
}

// 修改用户密码
export function resetPw(data) {
  return request({
    url: `/kd_admin//servicer/reset_pw`,
    method: 'post',
    data: data
  })
}

export function addPackage(data) {
  return request({
    url: `kd_admin//sp/package/add`,
    method: 'post',
    data: data
  })
}

export function updatePackage(data) {
  return request({
    url: `kd_admin//sp/package/update`,
    method: 'post',
    data: data
  })
}
export function deletePackage(id) {
  return request({
    url: `kd_admin//sp/package/delete`,
    method: 'post',
    data: { id: id }
  })
}

export function listPackage() {
  return request({
    url: `kd_admin//sp/package/list`,
    method: 'get'
  })
}

export function pagePackage(data) {
  return request({
    url: `kd_admin//sp/package/page`,
    method: 'post',
    data: data
  })
}

export function getPackageFeatures(packageId) {
  return request({
    url: `kd_admin//sp/package/getPackageFeatures`,
    method: 'get',
    params: { packageId: packageId }
  })
}

